package com.yazi.mxz.mobile.jackson.filter;

import java.util.HashSet;
import java.util.Set;

import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.yazi.mxz.common.entity.beans.Shopping;
import com.yazi.mxz.common.entity.beans.ShoppingCart;
import com.yazi.mxz.common.entity.beans.Store;
import com.yazi.mxz.common.entity.beans.StoreGoods;

public abstract class ShoppingCartFilter {

	public static FilterProvider get4List() {
		final Set<String> cart = new HashSet<String>();
		cart.add("cartId");
		cart.add("store");
		cart.add("shoppings");

		final Set<String> store = new HashSet<String>();
		store.add("storeId");
		store.add("name");

		final Set<String> shopping = new HashSet<String>();
		shopping.add("shoppingId");
		shopping.add("buyCount");
		shopping.add("storeGoods");

		final Set<String> storeGoods = new HashSet<String>();
		storeGoods.add("storeGoodsId");
		storeGoods.add("pic");
		storeGoods.add("title");
		storeGoods.add("price");
		storeGoods.add("originalPrice");
		storeGoods.add("atDiscount");
		storeGoods.add("unit");
		storeGoods.add("sellUnit");
		storeGoods.add("unitConvert");
		storeGoods.add("stock");
		storeGoods.add("stockConvert");
		storeGoods.add("sellMin");
		storeGoods.add("sellExt");

		return new SimpleFilterProvider()
				.addFilter(ShoppingCart.class.getSimpleName(),
						SimpleBeanPropertyFilter.filterOutAllExcept(cart))
				.addFilter(Store.class.getSimpleName(),
						SimpleBeanPropertyFilter.filterOutAllExcept(store))
				.addFilter(Shopping.class.getSimpleName(),
						SimpleBeanPropertyFilter.filterOutAllExcept(shopping))
				.addFilter(StoreGoods.class.getSimpleName(),
						SimpleBeanPropertyFilter.filterOutAllExcept(storeGoods));
	}

}
